package com.memory.test.service.impl;

import com.memory.test.mbg.mapper.MErrorwordsMapper;
import com.memory.test.mbg.model.MErrorwords;
import com.memory.test.mbg.model.MErrorwordsExample;
import com.memory.test.service.ErrorWordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ErrorWordServiceImpl implements ErrorWordService {

    @Autowired
    private MErrorwordsMapper mErrorwordsMapper;

    @Override
    public void addWord(MErrorwords errorWord) {
        mErrorwordsMapper.insert(errorWord);
    }

    @Override
    public MErrorwords findByUserIdAndWordId(Long userId, Long wordId) {
        return mErrorwordsMapper.selectByPrimaryKey(wordId,userId);
    }

    @Override
    public void updateWord(MErrorwords errorWord) {
        mErrorwordsMapper.updateByPrimaryKey(errorWord);
    }

    @Override
    public void deleteErrorWord(MErrorwords byUserIdAndWordId) {
       mErrorwordsMapper.deleteByPrimaryKey(byUserIdAndWordId.getWordId(), byUserIdAndWordId.getUserId());

    }
}
